import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import { resolve } from 'path'

export default defineConfig({
  plugins: [vue()],
  // 配置服务地址
  server:{
    host: '0.0.0.0',  // 解决vite use `--host` ex expose
    port: 3100,
    open: false,
    hmr: {
      overlay: true
    },
    proxy: {
      "/api": {
        target: "http://118.178.187.116:9088",
         // target: "http://127.0.0.1:9088",
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ""),
      },
    }
  },
  resolve:{
    alias:[
      {
        // 此处配置的@ 可以在项目中代替src的路径
        find: '@',
        replacement: resolve(__dirname, 'src')
      },

    ]
  }
})
